Skip to content

Add flaky pytest infrastructure and weekend runners #1799

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 26 commits into from
Jun 13, 2025

Conversation

paul0403
Copy link
Member

Context:
We wish to reduce flaky tests in CI.
There is a python package flaky (which we already have in our requirements.txt) that reruns failed tests to hunt for flakiness.
Let's actually use it.

Description of the Change:

  • Add flaky infrastructure. A pytest run that hunts for flaky tests can be launched by make pytest ENABLE_FLAKY=ON
  • 4 tests that change some global state cannot be run more than once. We force them to be run only once. None of them are of a stochastic nature
  • Add a script to launch flaky hunting runs on weekends.

Benefits:
If any new tests are flaky, this weekend runner will catch them!

[sc-87028]

@paul0403 paul0403 requested a review from a team June 10, 2025 20:27
Copy link
Contributor

Hello. You may have forgotten to update the changelog!
Please edit doc/releases/changelog-dev.md on your branch with:

  • A one-to-two sentence description of the change. You may include a small working example for new features.
  • A link back to this PR.
  • Your name (or GitHub username) in the contributors section.

Copy link
Contributor

@dime10 dime10 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great idea 💯

The only thing I would say is that we should fix those global state mutations instead of forcing the tests to only run once :)

@paul0403
Copy link
Member Author

paul0403 commented Jun 11, 2025

Since this action installs from testpypi, this PR's CI will fail tests for tests depending on new features still not on testpypi yet. For example, Tuesday midnight's test pypi will fail tests added on Wednesday.

This is fine. I only enable the script on PRs to check the script itself.

Copy link

codecov bot commented Jun 11, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.61%. Comparing base (7a8dbff) to head (d26d043).
Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1799   +/-   ##
=======================================
  Coverage   96.61%   96.61%           
=======================================
  Files          82       82           
  Lines        9265     9265           
  Branches      875      875           
=======================================
  Hits         8951     8951           
  Misses        255      255           
  Partials       59       59           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@paul0403 paul0403 requested a review from dime10 June 11, 2025 20:51
Copy link
Contributor

@dime10 dime10 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @paul0403 !

paul0403 and others added 3 commits June 13, 2025 13:19
@paul0403 paul0403 merged commit 9bb7cf0 into main Jun 13, 2025
39 checks passed
@paul0403 paul0403 deleted the paul0403/add_flaky_runs branch June 13, 2025 20:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants